/*
 * tools.h
 *
 *  Created on: 23.10.2011
 *      Author: David
 */

#ifndef TOOLS_H_
#define TOOLS_H_

#include "typedef.h"

#define U8_INVERT(x) ((x)^0xFF)
#define U8_CLR_BIT(x, p) ((x) &= ((1 << (p)) ^ 0xFF))
#define U8_SET_BIT(x, p) ((x) |= (1 << (p)))
#define U8_BIT_ASSIGN(x, p, s) ((x) = ((x) & ((1 << (p)) ^ 0xFF)) | ((s) << (p)))

#define U16_ABS_VALUE(x) ((u16)(((x)<0?0-(x):(x))))

extern void u82bcd(u8 val,u8 result[]);

#endif /* TOOLS_H_ */
